home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / X11 / xmcd-1.4 / libdi.d / vu_sony.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-10  |  8.5 KB  |  241 lines

  1. /*
  2.  *   libdi - CD Audio Player Device Interface Library
  3.  *
  4.  *   Copyright (C) 1995  Ti Kan
  5.  *   E-mail: ti@amb.org
  6.  *
  7.  *   This program is free software; you can redistribute it and/or modify
  8.  *   it under the terms of the GNU General Public License as published by
  9.  *   the Free Software Foundation; either version 2 of the License, or
  10.  *   (at your option) any later version.
  11.  *
  12.  *   This program is distributed in the hope that it will be useful,
  13.  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.  *   GNU General Public License for more details.
  16.  *
  17.  *   You should have received a copy of the GNU General Public License
  18.  *   along with this program; if not, write to the Free Software
  19.  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  *
  21.  *   The name "Sony" is a trademark of Sony Corporation, and is used
  22.  *   here for identification purposes only.  This software and its
  23.  *   author are not affiliated in any way with Sony.
  24.  *
  25.  */
  26. #ifndef __VU_SONY_H__
  27. #define __VU_SONY_H__
  28.  
  29. #ifdef VENDOR_SONY
  30.  
  31. #ifndef LINT
  32. static char *_vu_sony_h_ident_ = "@(#)vu_sony.h    5.2 94/12/28";
  33. #endif
  34.  
  35.  
  36. /* Sony vendor-unique commands */
  37. #define OP_VS_SETADDRFMT    0xc0    /* Sony set address format */
  38. #define OP_VS_RDTOC        0xc1    /* Sony read TOC */
  39. #define OP_VS_RDSUBQ        0xc2    /* Sony read subchannel */
  40. #define OP_VS_RDHDR        0xc3    /* Sony read header */
  41. #define OP_VS_PLAYSTAT        0xc4    /* Sony playback status */
  42. #define OP_VS_PAUSE        0xc5    /* Sony pause */
  43. #define OP_VS_PLAYTRK        0xc6    /* Sony play track */
  44. #define OP_VS_PLAYMSF        0xc7    /* Sony play MSF */
  45. #define OP_VS_PLAYAUD        0xc8    /* Sony play audio */
  46. #define OP_VS_PLAYCTL        0xc9    /* Sony playback control */
  47.  
  48.  
  49. /* Sony audio status codes */
  50. #define SAUD_PLAYING        0x00    /* audio play in progress */
  51. #define SAUD_PAUSED        0x01    /* audio pause in progress */
  52. #define SAUD_MUTED        0x02    /* audio muting on */
  53. #define SAUD_COMPLETED        0x03    /* audio play successfully completed */
  54. #define SAUD_ERROR        0x04    /* error occurred during audio play */
  55. #define SAUD_NOTREQ        0x05    /* audio play not requested */
  56.  
  57.  
  58. /* Return data lengths */
  59. #define SZ_VS_RDTOC        604    /* Sony read TOC data size */
  60. #define SZ_VS_TOCHDR        4    /* Sony read TOC header data size */
  61. #define SZ_VS_TOCENT        6    /* Sony read TOC header entry size */
  62. #define SZ_VS_RDSUBQ        9    /* Sony read sub-code Q data size */
  63. #define SZ_VS_PLAYSTAT        18    /* Sony read disc info data size */
  64. #define SZ_VS_CDPARM        16    /* CD-ROM parameters data size */
  65.  
  66. /* Mode Sense/Mode Select page code */
  67. #define PG_VS_CDPARM        0x8    /* CD-ROM parameters page */
  68.  
  69.  
  70. /* Sony read subchannel command data */
  71. typedef struct ssubq_data {
  72. #if _BYTE_ORDER_ == _L_ENDIAN_
  73.     unsigned int    preemph:1;    /* preemphasis */
  74.     unsigned int    copyallow:1;    /* digital copy allow */
  75.     unsigned int    trktype:1;    /* 0=audio 1=data */
  76.     unsigned int    audioch:1;    /* 0=2ch 1=4ch */
  77.     unsigned int    reserved:4;    /* reserved */
  78. #else    /* _BYTE_ORDER_ == _B_ENDIAN_ */
  79.     unsigned int    reserved:4;    /* reserved */
  80.     unsigned int    audioch:1;    /* 0=2ch 1=4ch */
  81.     unsigned int    trktype:1;    /* 0=audio 1=data */
  82.     unsigned int    copyallow:1;    /* digital copy allow */
  83.     unsigned int    preemph:1;    /* preemphasis */
  84. #endif    /* _BYTE_ORDER_ */
  85.     unsigned int    trkno:8;    /* track number */
  86.     unsigned int    idxno:8;    /* index number */
  87.     unsigned int    rel_min:8;    /* trk relative minutes */
  88.  
  89.     unsigned int    rel_sec:8;    /* trk relative seconds */
  90.     unsigned int    rel_frame:8;    /* trk relative frame */
  91.     unsigned int    abs_min:8;    /* absolute minutes */
  92.     unsigned int    abs_sec:8;    /* absolute seconds */
  93.  
  94.     unsigned int    abs_frame:8;    /* absolute frame */
  95.     unsigned int    pad1:24;    /* pad for alignment */
  96. } ssubq_data_t;
  97.  
  98.  
  99. /* Sony read TOC command data */
  100. typedef struct stoc_data {
  101.     unsigned int    data_len:16;    /* data length */
  102.     unsigned int    first_trk:8;    /* first track */
  103.     unsigned int    last_trk:8;    /* last track */
  104.  
  105.     byte_t        trkdata[600];    /* track info */
  106. } stoc_data_t;
  107.  
  108. typedef struct stoc_ent {
  109.     unsigned int    trkno:8;    /* track number */
  110. #if _BYTE_ORDER_ == _L_ENDIAN_
  111.     unsigned int    preemph:1;    /* preemphasis */
  112.     unsigned int    copyallow:1;    /* digital copy allow */
  113.     unsigned int    trktype:1;    /* 0=audio 1=data */
  114.     unsigned int    audioch:1;    /* 0=2ch 1=4ch */
  115.     unsigned int    res1:4;        /* reserved */
  116. #else    /* _BYTE_ORDER_ == _B_ENDIAN_ */
  117.     unsigned int    res1:4;        /* reserved */
  118.     unsigned int    audioch:1;    /* 0=2ch 1=4ch */
  119.     unsigned int    trktype:1;    /* 0=audio 1=data */
  120.     unsigned int    copyallow:1;    /* digital copy allow */
  121.     unsigned int    preemph:1;    /* preemphasis */
  122. #endif    /* _BYTE_ORDER_ */
  123.     unsigned int    res2:8;        /* reserved */
  124.     unsigned int    min:8;        /* minutes */
  125.  
  126.     unsigned int    sec:8;        /* seconds */
  127.     unsigned int    frame:8;    /* frame */
  128.     unsigned int    pad1:16;    /* pad bytes for alignment */
  129. } stoc_ent_t;
  130.  
  131.  
  132. /* Sony play status command data */
  133. typedef struct sstat_data {
  134.     unsigned int    res1:8;        /* reserved */
  135. #if _BYTE_ORDER_ == _L_ENDIAN_
  136.     unsigned int    lbamsf:1;    /* address format bit */
  137.     unsigned int    res2:7;        /* reserved */
  138.     unsigned int    data_len:16;    /* audio status data length */
  139.  
  140.     unsigned int    audio_status:8;    /* audio status */
  141.     unsigned int    preemph:1;    /* preemphasis */
  142.     unsigned int    copyallow:1;    /* digital copy allow */
  143.     unsigned int    trktype:1;    /* 0=audio 1=data */
  144.     unsigned int    audioch:1;    /* 0=2ch 1=4ch */
  145.     unsigned int    res3:4;        /* reserved */
  146.     unsigned int    res4:8;        /* reserved */
  147.     unsigned int    min:8;        /* CD address: minute */
  148.  
  149.     unsigned int    sec:8;        /* CD address: second */
  150.     unsigned int    frame:8;    /* CD address: frame */
  151.     unsigned int    sel0:4;        /* output select for channel 0 */
  152.     unsigned int    res5:4;        /* reserved */
  153.     unsigned int    vol0:8;        /* channel 0 volume */
  154.  
  155.     unsigned int    sel1:4;        /* output select for channel 1 */
  156.     unsigned int    res6:4;        /* reserved */
  157.     unsigned int    vol1:8;        /* channel 1 volume */
  158.     unsigned int    sel2:4;        /* output select for channel 2 */
  159.     unsigned int    res7:4;        /* reserved */
  160.     unsigned int    vol2:8;        /* channel 2 volume */
  161.  
  162.     unsigned int    sel3:4;        /* output select for channel 3 */
  163.     unsigned int    res8:4;        /* reserved */
  164.     unsigned int    vol3:8;        /* channel 3 volume */
  165. #else    /* _BYTE_ORDER_ == _B_ENDIAN_ */
  166.     unsigned int    res2:7;        /* reserved */
  167.     unsigned int    lbamsf:1;    /* address format bit */
  168.     unsigned int    data_len:16;    /* audio status data length */
  169.  
  170.     unsigned int    audio_status:8;    /* audio status */
  171.     unsigned int    res3:4;        /* reserved */
  172.     unsigned int    audioch:1;    /* 0=2ch 1=4ch */
  173.     unsigned int    trktype:1;    /* 0=audio 1=data */
  174.     unsigned int    copyallow:1;    /* digital copy allow */
  175.     unsigned int    preemph:1;    /* preemphasis */
  176.     unsigned int    res4:8;        /* reserved */
  177.     unsigned int    min:8;        /* CD address: minute */
  178.  
  179.     unsigned int    sec:8;        /* CD address: second */
  180.     unsigned int    frame:8;    /* CD address: frame */
  181.     unsigned int    res5:4;        /* reserved */
  182.     unsigned int    sel0:4;        /* output select for channel 0 */
  183.     unsigned int    vol0:8;        /* channel 0 volume */
  184.  
  185.     unsigned int    res6:4;        /* reserved */
  186.     unsigned int    sel1:4;        /* output select for channel 1 */
  187.     unsigned int    vol1:8;        /* channel 1 volume */
  188.     unsigned int    res7:4;        /* reserved */
  189.     unsigned int    sel2:4;        /* output select for channel 2 */
  190.     unsigned int    vol2:8;        /* channel 2 volume */
  191.  
  192.     unsigned int    res8:4;        /* reserved */
  193.     unsigned int    sel3:4;        /* output select for channel 3 */
  194.     unsigned int    vol3:8;        /* channel 3 volume */
  195. #endif    /* _BYTE_ORDER_ */
  196.     unsigned int    pad1:16;    /* pad for alignment */
  197. } sstat_data_t;
  198.  
  199.  
  200. /* Mode Sense/Mode Select CD-ROM parameters page data structure */
  201. typedef struct cdparm_pg {
  202. #if _BYTE_ORDER_ == _L_ENDIAN_
  203.     unsigned int    pg_code:6;    /* page code */
  204.     unsigned int    res0:2;        /* reserved */
  205.     unsigned int    pg_len:8;    /* page length */
  206.     unsigned int    lbamsf:1;    /* LBA/MSF addr format ctrl bit */
  207.     unsigned int    res1:7;        /* reserved */
  208.     unsigned int    inact_mult:4;    /* inactivity timer multiplier */
  209.     unsigned int    res2:4;        /* reserved */
  210. #else    /* _BYTE_ORDER_ == _B_ENDIAN_ */
  211.     unsigned int    res0:2;        /* reserved */
  212.     unsigned int    pg_code:6;    /* page code */
  213.     unsigned int    pg_len:8;    /* page length */
  214.     unsigned int    res1:7;        /* reserved */
  215.     unsigned int    lbamsf:1;    /* LBA/MSF addr format ctrl bit */
  216.     unsigned int    res2:4;        /* reserved */
  217.     unsigned int    inact_mult:4;    /* inactivity timer multiplier */
  218. #endif    /* _BYTE_ORDER_ */
  219. } cdparm_pg_t;
  220.  
  221.  
  222. /* Public function prototypes */
  223. extern bool_t    sony_playaudio(byte_t, word32_t, word32_t, msf_t *, msf_t *,
  224.             byte_t, byte_t);
  225. extern bool_t    sony_pause_resume(bool_t);
  226. extern bool_t    sony_get_playstatus(curstat_t *, byte_t *);
  227. extern bool_t    sony_get_toc(curstat_t *);
  228. extern int    sony_volume(int, curstat_t *, bool_t);
  229. extern bool_t    sony_route(curstat_t *);
  230. extern void    sony_init(void);
  231. extern void    sony_start(void);
  232.  
  233. #else
  234.  
  235. #define sony_init    NULL
  236.  
  237. #endif    /* VENDOR_SONY */
  238.  
  239. #endif    /* __VU_SONY_H__ */
  240.  
  241.